<?php

use think\migration\Migrator;
use think\migration\db\Column;

class SystemSetting extends Migrator
{
    /**
     * 系统配置
     */
    public function change()
    {
        $table = $this->table('system_setting');
        $table
            //step1:图表
            ->addColumn('type', 'string', ['limit' => 50, 'comment' => '类型：system系统/alarm报警'])
            ->addColumn('type2', 'string', ['limit' => 50, 'default' => '', 'comment' => '类型2，针对type的扩展，有的有这些设置,exceed超标/stop停运/fault故障'])

            //step2:值
            ->addColumn('name_en', 'string', ['limit' => 50, 'comment' => '系统名称-英文'])
            ->addColumn('name_zh', 'string', ['limit' => 50, 'comment' => '系统名称-中文'])
            ->addColumn('value', 'string', ['limit' => 30, 'comment' => '系统值'])
            ->addColumn('details', 'string', ['limit' => 250, 'comment' => '详情解释'])

            //step4:相关ID
            ->addColumn('region_id', 'integer', ['comment'=>'城市ID',])

            //step5:插入时间
            ->addColumn('create_time', 'integer', ['comment' => '插入时间'])

            ->addColumn('delete_time', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '删除时间0正常，不为0记录删除时间'])

            //注释
            ->setComment('系统 - 配置')

            //引擎
            ->setEngine('InnoDB')
            ->save();
    }
}
